<?php 
    session_start();
    if(!isset($_SESSION['islogined']))
        header("location:./Login.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link href="app.css" rel="stylesheet">
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

</head>
<body>
    <?php include 'header1.php'; ?>
    <div class="container">
        <ol class="breadcrumb path-nav">
            <li><a href="./Home.php">Home</a></li>
            <li class="active">Personal Information</li>
        </ol>
    </div>
    <div class="container addstaff-form">
        <h2 class='form-header'>Your Information</h2>
        <div class="infor-show">
        <?php 
            include'infor_staff.php';
            personal_infor_show();
         ?>
         </div>
        <div class="col-md-2 col-md-offset-5">
            <button id="p_infor_button" class="btn btn-default allocate-btn">Edit</button>
        </div> 
    </div>
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
<script src="jquery-3.0.0.min.js"></script>
<script src="bootstrap.min.js"></script>
<script>
    $(function(){
        $("#p_infor_button").click(function(){
            $.post("infor_staff.php",{
                type:"edit_infor_show"
            },function(data){
                $("#myModal").html(data);
                $("#myModal").modal();
            });
        });
        $(document).on("click","#m_pinfo_button",function(){
            $(".success-modify").remove();
            var firstname=$("#first_name").val();
            var lastname=$("#last_name").val();
            var title=$("#title").val();
            var email=$("#email").val();
            var phoneNo=$("#phoneNo").val();
            $.post("infor_staff.php",{
                type:"update_pinfor",
                firstname:firstname,
                lastname:lastname,
                title:title,
                email:email,
                phoneNo:phoneNo
            },function(data){
                $(".form-header").before("<div class='success-modify'>Update Successfully</div>");
                $(".infor-show").html(data);
            });
        });
    })
</script>
</body>
</html>
